<!doctype html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>联通大数据交易集市</title>
    <meta name="keywords" content="抓手数据|大数据交易|大数据|数据包|生态圈|数据包集市|API集市|报告集市"/>
    <meta name="description" content="抓手数据平台是一个全网系大数据交易平台，是独立同时支持个人和机构用户的综合实时在线交易系统，旨在促进数据流通、公正、有公信力、创新型的第三方数据交易平台，平台提供数据出售、数据购买、数据提供商查询以及数据需求发布等模块综合配套服务。"/>
    <link rel="icon" href="<?=base_url()?>images/favicon.ico"/>
    <link rel="stylesheet" type="text/css" href="<?=base_url()?>css/login.css">
    <link rel="stylesheet" type="text/css" href="<?=base_url()?>css/tpshop.css"/>
    <script type="text/javascript" src="<?=base_url()?>js/jquery-1.11.3.min.js"></script>
    <script src="<?=base_url()?>js/layer.js"></script>
    <style>
        .footer-ul li span {
            font-size: 22px;
            display: inline-block;
            position: relative;
            top: 17px;
            left: 20px;        
        }
    </style>
</head>
<body>
<div class="header area">
    <div class="ecsc-logo" style="margin-left: calc(50% - 88px);">
        <a class="logo" href="/"><img src="<?=base_url()?>photos/logo3.png"/></a>
    </div>
</div>
<div class="m-login" id="divMLogin">
    <div class="login-form">
        <div class="title oh">
            用户登录
        </div>
        <form id="login-form" method="post">
            <div class="u-input mb20">
                <label class="u-label u-name"></label>
                <input type="text" class="u-txt J-input-txt" value="" placeholder="手机号/邮箱" name="username" id="username"
                       autocomplete="off">
            </div>
            <div class="u-input mb15">
                <label class="u-label u-pwd"></label>
                <input type="password" class="u-txt J-input-txt" placeholder="密码" name="password" id="password"
                       autocomplete="off">
            </div>
            <div class="u-input mb15">
                <input type="text" placeholder="不区分大小写" name="verify_code" id="verify_code" class="u-txt J-input-txt"
                       style="width:140px; padding:10px;"/>
                <img onclick="verify(this);" width="140" height="42" src="" id="verify_code_img" class="po-ab to0">
            </div>
            <div class="u-safe">
          <span class="auto">
            <label>
                <input type="hidden" name="referurl" id="referurl" value="https://www.zhuashou.net/">
                <input type="checkbox" class="u-ckb J-auto-rmb" name="remember">自动登录
            </label>
          </span>
                <span class="forget"><a href="/Home-User-forget_pwd.html">忘记密码</a> | <a href="register">注册</a></span>
            </div>
            <div class="u-btn mt20"><a href="javascript:void(0);" onClick="checkSubmit();" class="J-login-submit"
                                       name="sbtbutton">登&nbsp;&nbsp;&nbsp;&nbsp;录</a></div>
        </form>
    </div>
</div>
</div>
<div class="goContact">
    <img src="<?=base_url()?>images/contact.png" alt="客服">
</div>
<div class="contact_type">
    <div class="right-contact-us">
        <span class="phone">010-65916788</span>
    </div>
</div>
<div class="goTop">
    <img src="<?=base_url()?>images/goTop.png" alt="返回顶部">
</div>
<script>
    var min_height = $(window).height();
    $(window).scroll(function () {
        var s = $(window).scrollTop();
        if (s > min_height) {
            $(".goTop").show();
        } else {
            $(".goTop").hide();
        }
        ;
    });
    $(".goTop").mouseenter(function () {
        $(this).find("img").attr("src", "<?=base_url()?>images/goTop_w.png");
        $(".goTop").click(function () {
            $("html,body").animate({scrollTop: 0}, 500);
        });
        $(".goTop").mouseleave(function () {
            $(this).find("img").attr("src", "<?=base_url()?>images/goTop.png");
        });
    });
    $(".goContact").mouseenter(function () {
        $(".contact_type").animate({width: "135px"}, 100);
        $(this).find("img").attr("src", "<?=base_url()?>images/contact_w.png");
        $(".goContact").mouseleave(function () {
            $(".contact_type").animate({width: "0px"}, 100);
            $(this).find("img").attr("src", "<?=base_url()?>images/contact.png");
        });
    });
</script>

<script>
    var footerT = min_height - 346;
    var bodyH = $("body").height();
    if (bodyH <= min_height) {
        $(".footer").css({
            position: 'absolute',
            top: footerT + 'px',
            bottom: 0,
            left: 0,
            right: 0
        });
    }
</script>

<script>
    $(function () {
        verify();
    })
    // Enter登录
    document.onkeydown = function (event) {
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if (e && e.keyCode == 13) {
            checkSubmit();
        }
    }

    function checkSubmit() {
        $('.msg-err').hide();
        $('.J-errorMsg').empty();
        var username = $.trim($('#username').val());
        var password = $.trim($('#password').val());
        var referurl = $('#referurl').val();
        var verify_code = $.trim($('#verify_code').val());
        if (username == '') {
            showErrorMsg('用户名不能为空!');
            return false;
        }
        if (!checkMobile(username) && !checkEmail(username)) {
            showErrorMsg('用户名格式不匹配!');
            return false;
        }
        if (password == '') {
            showErrorMsg('密码不能为空!');
            return false;
        }
        if (verify_code == '') {
            showErrorMsg('验证码不能为空!');
            return false;
        }
        //$('#login-form').submit();
        $.ajax({
            type: 'post',
            url: '<?=base_url()?>/index.php/home/login/login/verifyLogin',
            data: {username: username, password: password, referurl: referurl, verify_code: verify_code},
            dataType: 'json',
            success: function (res) {
                /*if (res.code) {
                    window.location.href = res.url;
                } else {
                    showErrorMsg(res.msg);
                    verify();
                }*/
                if(res.code){
                    showErrorMsg(res.desc);
                } else {
                    window.location.href = res.url;
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                showErrorMsg('网络失败，请刷新页面后重试');
            }
        })

    }

    function checkMobile(tel) {
        var reg = /^1[0-9]{10}$/;
        if (reg.test(tel)) {
            return true;
        } else {
            return false;
        }
        ;
    }

    function checkEmail(str) {
        var reg = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
        if (reg.test(str)) {
            return true;
        } else {
            return false;
        }
    }

    function showErrorMsg(msg) {
        layer.alert(msg, {icon: 2, time: 2000});
    }

    function verify() {
        $('#verify_code_img').attr('src', "<?=base_url()?>index.php/home/captcha/index?r=" + Math.random());
    }
</script>
</body>
</html>